vim.cmd [[packadd packer.nvim]]
vim.cmd 'autocmd BufWritePost plugins.lua PackerCompile'

require('plugins')
vim.opt.laststatus = 2
vim.opt.showtabline = 2

vim.cmd("colorscheme onedark")
-- vim.cmd [[colorscheme onedark]]
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- luasnip setup
local luasnip = require 'luasnip'

local function set_keymap(...)
	vim.api.nvim_set_keymap(...)
end

local opts = { noremap = true, silent = true }
set_keymap('n', '<leader>ff',
	'<cmd>lua require(\'telescope.builtin\').find_files()<cr>', opts)
set_keymap('n', '<leader>fm',
	'<cmd>lua require((\'telescope.builtin\')).oldfiles()<cr>', opts)
set_keymap('n', '<leader>fg',
	'<cmd>lua require((\'telescope.builtin\')).live_grep()<cr>', opts)
set_keymap('t', '<Esc>', '<C-\\><C-n>', opts)

local result = vim.api.nvim_exec([[
     
     let g:aniseed#env = v:true

     nnoremap ,y "+
     xnoremap ,y "+
     nnoremap ,p "0p
     xnoremap ,p "0p
     nnoremap ,P "0P
     xnoremap ,P "0P

     inoremap ,p <c-r>0
     cnoremap ,p <c-r>0
     inoremap ,yp <c-r>+
     cnoremap ,yp <c-r>+

     nnoremap ,y- "-p
     xnoremap ,y- "-p
     inoremap ,y- <c-r>-
     cnoremap ,y- <c-r>-
     set completeopt=menu,menuone,noselect
     set encoding=utf-8
     set hidden
     set nobackup
     set nowritebackup
     set cmdheight=3
     set updatetime=300
     set shortmess+=c
     set autoindent
     set cindent
     set shiftwidth=4
     set tags=./.tags;,.tags
     syntax on
     set number
     set backspace=indent,eol,start
     set background=dark
     set nohlsearch

     au BufNewFile,BufRead *.c:SymbolsOutline<CR>

     set foldmethod=expr
     set foldexpr=nvim_treesitter#foldexpr()
     set mouse =

     if exists('g:fvim_loaded')
          " good old 'set guifont' compatibility with HiDPI hints...
          if g:fvim_os == 'windows' || g:fvim_render_scale > 1.0
               set guifont=CodeNewRoman\ Nerd\ Font\ Mono:h18
          else
               set guifont=CodeNewRoman\ Nerd\ Font\ Mono:h18
          endif

          " Ctrl-ScrollWheel for zooming in/out
          nnoremap <silent> <C-ScrollWheelUp> :set guifont=+<CR>
          nnoremap <silent> <C-ScrollWheelDown> :set guifont=-<CR>
          nnoremap <A-CR> :FVimToggleFullScreen<CR>
     endif

     ]], false)

local local_vimrc = vim.fn.getcwd() .. '/.nvimrc'
if vim.loop.fs_stat(local_vimrc) then vim.cmd('source ' .. local_vimrc) end